#include "eveCommon.h"
#include "eveGuiControl.h"
#include "eveGuiConfigLoader.h"
#include "eveTheme.h"
#include "eveImageDescriptor.h"
#include "eveGuiDialog.h"
#include "eveGuiTypes.h"

CGuiConfigLoader::CGuiConfigLoader()
{
}


CGuiConfigLoader::~CGuiConfigLoader()
{
}

void CGuiConfigLoader::Load(const String& name,CGuiDialog& dlg)
{
	TiXmlDocument doc;
	TiXmlElement* gui = LoadXMLFile(name,doc);
	if( gui )
	{
		XMLElementWrapper wrapper(gui);
		const String& str = wrapper.GetStringValue("theme");
//		int id = wrapper.GetIntValue("id");
		int style = wrapper.GetIntValue("style");
		String name = wrapper.GetStringValue("name");
		dlg.SetName(name);
		Theme* theme = ThemeManager::GetSingleton()->GetThemeByName(str);
		if( !theme ) return;

		dlg.CGuiControl::Create(gui,theme);
	}
}

